package com.larly.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.larly.common.DelectRequest;
import com.larly.common.IdRequest;
import com.larly.model.domain.Notes;
import com.baomidou.mybatisplus.extension.service.IService;
import com.larly.model.dto.notes.AddNotesRequest;
import com.larly.model.dto.notes.EditNotesRequest;
import com.larly.model.dto.notes.RollbackNotesRequest;
import com.larly.model.dto.notes.SelectNotesRequest;
import com.larly.model.vo.NoteVersionsVO;
import com.larly.model.vo.NotesVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author 许颢达
* @description 针对表【notes(存储所有学习笔记的核心表)】的数据库操作Service
* @createDate 2025-08-19 15:26:09
*/
public interface NotesService extends IService<Notes> {

    /**
     * 添加笔记
     * @param addNotesRequest 笔记信息
     * @return 笔记ID
     */
    long addNote(AddNotesRequest addNotesRequest, HttpServletRequest request);

    /**
     * 修改笔记
     * @param editNotesRequest 笔记信息
     * @return 是否修改成功
     */
    boolean editNote(EditNotesRequest editNotesRequest,HttpServletRequest request);


    /**
     * 笔记放到回收站
     * @param delectRequest 笔记信息
     * @return 是否删除成功
     */
    boolean deleteNote(DelectRequest delectRequest,HttpServletRequest request);

    /**
     * 清空回收站
     * @return 是否清空成功
     */
    boolean clearDeletedNotes(HttpServletRequest request);

    /**
     * 恢复笔记
     */
    boolean recoverNote(IdRequest idRequest,HttpServletRequest request);

    /**
     * 获取版本记录列表
     */
    List<NoteVersionsVO> getNoteVersions(Integer noteId);

    /**
     * 笔记回滚
     * @param rollbackNotesRequest 笔记信息
     * @return 是否回滚成功
     */
    NotesVO rollbackNote(RollbackNotesRequest rollbackNotesRequest, HttpServletRequest request);

    /**
     * 获取NotesVo
     *
     * @param selectNotesRequest
     * @return
     */
    Page<NotesVO> selectNotes(SelectNotesRequest selectNotesRequest);

    /**
     * 点赞
     *
     * @param noteId
     * @param request
     * @return
     */
    boolean likeNote(Integer noteId, HttpServletRequest request);

    /**
     * 取消点赞
     *
     * @param noteId
     * @param request
     * @return
     */
    boolean cancelLikeNote(Integer noteId, HttpServletRequest request);

    /**
     * 上传笔记封面
     *
     * @param file
     * @return
     */
    String uploadCover(MultipartFile file,HttpServletRequest request);
}
